﻿var GetRealSurvey = {};
var propertyrealsurveyobtain = GetRealSurvey;
GetRealSurvey.init = function () {
    $(function () {
        $('#btnSeeAllPhotos').attr('href', '/property/property-photos?' + $('#parPropertyKeyId').val() + '&' + $('#parEstateId').val());

        $('#btnReserveShoot').click(function () {
            $.ajax({
                url: "/property/reserver-photegrapher",
                async: false,
                data: {
                    "PropertyId": $("#hidPropertyKeyId").val(),
                    "PropertyRegion": $("#parAreaName").val(),
                    "EstateName": $("#parEstateNameShort").val(),
                    "Floor": $("#parFloor").val(),
                    "RoomNumber": $("#parHouseNum").val(),
                    "BuildingArea": $("#parSquareShort").val(),
                    "Fang": $("#parCountF").val(),
                    "Ting": $("#parCountT").val(),
                    "Wei": $("#parCountW").val(),
                    "Dong": $("#parBuildingName").val()
                },
                dataType: "html",
                type: "post",
                success: function (data) {
                    $("#divForm").html(data);
                },
                complete: function () {
                    if ($("#divForm #ReserveForm")) {
                        $("#ReserveForm").submit();
                    }
                }
            });
        })
    });
}
//实勘删除
GetRealSurvey.realSurveyDelete = function (element) {
    //var isAffirm = confirm('您确定要删除当前实勘？');
    //if (!isAffirm) {
    //    return false;
    //}
    $.OKCancelDialogAgency('<div class="tc">您确定要删除当前实勘？</div>', '删除实勘', true, function () {
        $.AjaxAgency($(element).attr('opertionUrl'), null, function (data) {
            if (data == 'ok') {
                $.OKDialogAgency('<div class="tc">删除成功！</div>', '提示', function () {
                    GetRealSurvey.refreshPage();
                });
            } else {
                $.OKDialogAgency('<div class="tc">' + data + '</div>');
            }
        });
    });
};

//局部刷新是否实勘确认数据
GetRealSurvey.refreshPage = function () {
    var reUrl = $("#PropertyKeyIdhid").val();
    $.ajax({
        type: 'post',
        url: '/property/property-real-survey-obtain?propertyKeyId=' + reUrl,
        success: function (data) {
            $('#contentdiv').html(data);
        }
    });
}
